﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HeSeHus.Controller;
//using HeSeHus.Model;
using HeSeHus.Interface;
namespace HeSeHus
{
    /// <summary>
    /// Interaction logic for TilføjProperty.xaml
    /// </summary>
    public partial class TilføjProperty : Window
    {
        SystemController _controller;
        IMProduct _product;

        public TilføjProperty(IMProduct inObject, ref SystemController controller)
        {
            _product = inObject;
            _controller = controller;
            InitializeComponent();
            this.Title = "Tilføj property til: " +inObject.ProdId + " | " + inObject.Name;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (txtNyVærdi.Text != "")
            {
                _controller.TilføjProperty(txtNyVærdi.Text, txtPropertyVærdi.Text, _product);
                this.Close();
            }
        }

        private void CheckBox_Checked_1(object sender, RoutedEventArgs e)
        {
            txtNyVærdi.Visibility = Visibility.Visible;
            lblNyProperty.Visibility = Visibility.Visible;
            cboPropertyNavn.IsEnabled = false;
        }

        private void checkBoxNyProperty_Unchecked(object sender, RoutedEventArgs e)
        {
            txtNyVærdi.Visibility = Visibility.Collapsed;
            lblNyProperty.Visibility = Visibility.Collapsed;
            cboPropertyNavn.IsEnabled = true;
        }
    }
}
